<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty plugin
 *
 * Type:     modifier<br>
 * Name:     paypal<br>
 * Date:     Feb 26, 2003
 * Purpose:  convert \r\n, \r or \n to <<br>>
 * Input:<br>
 *         - contents = contents to replace
 *         - preceed_test = if true, includes preceeding break tags
 *           in replacement
 * Example:  {$text|paypal}
 * @link http://smarty.php.net/manual/en/language.modifier.paypal.php
 *          paypal (Smarty online manual)
 * @version  1.0
 * @author   Monte Ohrt <monte at ohrt dot com>
 * @param string
 * @return string
 */
function smarty_modifier_paypal($string, $type = 'addcart', $name = '', $model = '', $price = '')
{
	_lc('paypal.class.php');
	$paypalObj = new PaypalBase();
	if( $type == 'addcart' ) {
		if( $name == '' && $model == '' && $price == '' ) {
			return $paypalObj->getProductA($string);
		} else {
			return $paypalObj->getProductB($string, $name, $model, $price);
		}
	} elseif( $type == 'viewcart' ) {
		return $paypalObj->getCart();
	}
	
    return '';
}
/* vim: set expandtab: */
//
?>